﻿using MediatR;
using SheepStorage.API.Application.Command.SheepMomHistoryCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepMomHistoryHandler
{
    public class AddSheepMomHistoryCommandHandler : IRequestHandler<AddSheepMomHistoryCommand, Results<int>>
    {
        ISheepMomHistoryService _res;

        public AddSheepMomHistoryCommandHandler(ISheepMomHistoryService res)
        {
            _res = res;
        }

        public async Task<Results<int>> Handle(AddSheepMomHistoryCommand request, CancellationToken cancellationToken)
        {
            var list =await _res.AddSheepMomHistory(request.input);
            return Results<int>.DataResult(list);
        }
    }
}
